package com.csii.epaySandbox.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.csii.epaySandbox.entity.Data;
import com.csii.epaySandbox.exception.PreDataException;
import com.csii.epaySandbox.service.PreDataService;
import com.csii.epaySandbox.util.JsonResult;
import com.csii.epaySandbox.util.Utils;

@Controller
public class PreDataController extends AbstractController {
	
	@Resource
	private PreDataService preDataService;

	@RequestMapping("/confirmData.do")
	@ResponseBody
	public JsonResult confirmDataCtrl(Data data){
		if(Utils.isEmpty(data)){
			throw new PreDataException("传入数据异常或为空");
		}
		return new JsonResult(data);
	}
	
	@ExceptionHandler(PreDataException.class)
	@ResponseBody
	public JsonResult handlerPreDataException(PreDataException e){
		return new JsonResult(1,e);
	}
}
